package com.cloud.code.leetcode;

/**
 * 55. 跳跃游戏
 */
public class Demo7 {

    public static void main(String[] args) {
        canJump(new int[]{3,2,1,0,4});
    }

    public static boolean canJump(int[] nums) {

        int end = 0;
        for (int i = 0; i < nums.length; i++) {

            if(end < i){
                return false;
            }

            end= Math.max(end, nums[i] + i);

        }

        return true;

    }
}
